<include file="Public/head" />
</head>
<include file="Public/common_header" />
<link type="text/css" rel="stylesheet" href="{:get_style_cdnurl()}paimai/yunying/plugin/select2/select2.css" />
<script src="{:get_style_cdnurl()}paimai/yunying/plugin/select2/select2.js" type="text/javascript"></script>
<style type="text/css">
    .carowner_1,.carowner_2{display: block;margin-top: 10px;width:100%;height:25px;}
    .carowner_2{margin-left:0px;}
    .select_model{
        -moz-appearance: none;background: rgba(0, 0, 0, 0) url("http://img3.isou365.cn/paimai/yunying/images/sanjiao.jpg") no-repeat scroll 115px 5px;
        border: 1px solid #d7d7d7;
        float: left;height: 26px;line-height: 26px;margin-right: 8px;text-indent: 2px;width: 136px;}
    .select2-container .select2-choice {
        background: rgba(0, 0, 0, 0) url("http://img1.isou365.cn/paimai/yunying/images/sanjiao.jpg") no-repeat scroll 140px 5px;
        border: 1px solid #d7d7d7;
        color: #444;
        display: block;
        height: 24px;
        line-height: 24px;
        overflow: hidden;
        padding: 0 0 0 8px;
        position: relative;
        text-decoration: none;
        white-space: nowrap;
        width: 154px;
    }
    .text_model{
        border: 1px solid #d7d7d7;float: left;height: 24px;
        line-height: 24px;margin: 0 10px 10px 0;text-align: center;width: 150px;
    }
    .search_btn{height:26px;line-height:26px;
                background: #20ab4f none repeat scroll 0 0;border-radius: 3px;border:medium none;color: #fff;
                margin-left: 7px;padding: 0;width: 60px;float:left;}
    .table .mcenter{vertical-align: middle;text-align: center;}
    .check_time{float:left;}
</style>
<div class="mian">
<include file="Public/sidebar"  menu="pmgl.cszy" />
    <div class="mianR">
        <div class="yuyue">
            <ul>
                <li onclick="clear_params();get_list(0);" class="yuCurrent">待处理</li>
                <li onclick="clear_params();get_list(1);">协商成功</li>
                <li onclick="clear_params();get_list(2);">协商失败</li>
            </ul>
        </div>        

        <div class="yuList">
            <div class="yuSuo clearfix" style="float:left;">
                <form id="searchFrom">
                    <input id="status" name="status" type="hidden" value="{$params.search.status}"/>

                    <select name="issue_type" id="issue_type" class="select_model">
                        <option value="">请选择争议类型</option>
                        <?php foreach($issue_types as $tk=>$item):?>
                        <option value="{$tk}">{$item}</option>
                        <?php endforeach;?>       
                    </select>

                    <select name="location_area" id="location_area" class="select_model">
                        <if condition="count($bc_city) gt 1">
                            <option value="">请选择所在地</option>
                        </if>
                        <volist name="bc_city" id="city">
                            <option value="{$key}">{$city}</option>
                        </volist>
                    </select>

                    <select name="pay_status" id="pay_status" class="select_model">
                        <option value="0">请选择付款状态</option>
                        <option value="1">待付首款</option>
                        <option value="2">已付首款</option>
                    </select>
                     <!--<select id="from" name="from" class="select_model" readonly>-->
                        <!--<option value="0">请选择渠道来源</option>-->
                        <!--<?php foreach($pfrom as $item):?>-->
                        <!--<option value="{$item.from_id}">{$item.from_name}</option>-->
                        <!--<?php endforeach;?>-->
                    <!--</select>-->

                    <!--<select id="comeFrom" name="comefrom" style=" background-position: 116px 5px;" class="select_model" readonly>-->
                        <!--<option value="-2">请选择具体来源</option>-->
                    <!--</select>-->

                    <div class="source_input">
                        <input type="text" id="comefrm"  name="comefrom" value="" placeholder="请选择渠道来源" readOnly />
                        <div class="source">
                            <ul>
                                <?php foreach($pfrom as $item):?>
                                <li date="{$item.from_id}">{$item.from_name}</li>
                                <?php endforeach;?>
                            </ul>
                        </div>
                        <div class="sourceCity">
                            <ul>
                                <foreach name="bc_city" item="vo" key="k">
                                    <li date-city="{$k}">{$vo}</li>
                                </foreach>
                            </ul>
                        </div>
                        <div class="sourceTab">
                            <foreach name="comefrom_list" item="cl" key="k">
                                <div class="sourceList" date-pid="{$k}">
                                    <ul>
                                        <foreach name="cl" item="clv">
                                            <li date-id="{$clv.from_id}">{$clv.from_name}</li>
                                        </foreach>
                                    </ul>
                                </div>
                            </foreach>

                            <div class="sourceList siSdian">
                                <foreach name="city_fours_list" item="cfl" key="k">
                                    <ul style="display: none;" date-code-city="{$k}">
                                        <foreach name="cfl" item="cflv">
                                            <li date-id="{$cflv.from_id}">{$cflv.from_name}</li>
                                        </foreach>
                                    </ul>
                                </foreach>
                            </div>
                        </div>
                    </div>


                    <div id="showOption" style="display:none">
                        <volist name="from" id="vo">
                            <option class="{$vo['pid']}" value="{$vo['from_id']}" >{$vo['from_name']}</option>
                        </volist>
                    </div>
                    <input type="text" id="order_no" name="order_no" value="{$params.search.order_no}"  placeholder="车商联系人/联系人电话/拍卖单号"  class="suoDian suoDian1">

                    <!-- <input type="button" value="搜索" onClick="search()" class="suoSou search_btn" style="width:80px;"> -->
                    <input type="button" onclick="searchs();" id="search" value="搜索" class="suoSou" style="margin-left: 0px;">
                </form>
            </div>
        </div>
        <div class="listBox" id="listBox">
            {$content}
        </div>
        <div class="clear"></div>
    </div>
</div>
    </body>
</html>
<script type="text/javascript">
    $("body,html").click(function(event) {
        $(".sourceCity").hide();
        $(".sourceTab .sourceList").hide();
        $(".source").hide();
        event.stopPropagation();
    });

    $(".source_input").click(function(event) {
        event.stopPropagation();
    });
    $(".source_input input").val("");
    $(".source_input input").click(function() {
//            $(this).val("");
        if($(".source").css("display")=="none"){
            $(".source").fadeIn();
        }else{
            $(".source").hide();
        }
        $(".sourceCity").hide();
        $(".sourceTab .sourceList").hide();
    });
    var index;
    var text;
    var dateIndex;
    $(".source ul li").click(function() {
        index=$(".source ul li").index(this);
        text=$(this).html();
        dateIndex=$(this).attr("date");
        if(dateIndex==5){
            $(".sourceCity").fadeIn();
            $(".sourceTab .sourceList").hide();
        }else{
            $(".sourceCity").hide();
            $(".sourceTab .sourceList[date-pid='"+dateIndex+"']").fadeIn().siblings().hide();
        }
        $(this).parent().parent().hide();
    });
    var city;
    var cityIndex;
    $(".sourceCity ul li").click(function(i){
        city=$(this).html();
        $(this).parent().parent().hide();
        cityIndex=$(this).attr("date-city");
        $(".sourceTab .siSdian").fadeIn().find("ul[date-code-city='"+cityIndex+"']").fadeIn().siblings().hide();
    })
    $(".sourceList ul li").click(function(){
        $(this).parent().parent().hide();
        if(index==3){
            $(".source_input input").val(text+" - "+city+" - "+$(this).html());
            $(".source_input input").attr("real-value",$(this).attr("date-id"));
        }else{
            $(".source_input input").val(text+" - "+$(this).html());
            $(".source_input input").attr("real-value",$(this).attr("date-id"));
        }
    });


    function get_page(p){
        var data = $("#searchFrom").serialize() + "&" +encodeURI("p="+p);
        $.get("/IssueDealer/getList", data, function(data){
            $("#listBox").html(data);  
        },"html");
    }

    function searchs(){
        var status = $("#status").val();
        get_list(status);
    }

    function get_list(status){
        $("#status").val(status);
        if(status == 0){
            $("#pay_status").show();
        }else{
            $("#pay_status").hide();
        }
        // if(status == 1){
        //     $("#owner_id").attr('placeholder',"车型");
        // }else{
        //     $("#owner_id").attr('placeholder',"车主ID|姓名|车型");
        // }
        var url = get_url();
        $.get("/IssueDealer/getList?status=" + status ,url,function(data){
            $("#listBox").html(data);
        },"html");
    }

    function get_url(){
        var url = "";
        var comefrom = $("input[name='comefrom']").attr('real-value');
        var from = $('#from').val();
        var pay_status = $("#pay_status").val();
        var location_area = $("#location_area").val();
        var order_no = $("#order_no").val();
        var issue_type = $("#issue_type").val();
        if (comefrom) {
            url += '&comefrom=' + comefrom;
        }
        if (from) {
            url += '&from=' + from;
        }
        if (pay_status) {
            url += '&pay_status=' + pay_status;
        }
        if (location_area) {
            url += '&location_area=' + location_area;
        }
        if (order_no) {
            url += '&order_no=' + order_no;
        }
        if (issue_type) {
            url += '&issue_type=' + issue_type;
        }
        return url;
    }

    $("#from").change(function () {
        var value = $(this).val(); //获取渠道当前下拉列表选中的值
        //隐藏所有下拉列表的值
        $("#comeFrom option").each(function () {
            if ($(this).val() != '') {
                $(this).remove();
            }
        });

        //显示具体渠道下拉列表
        $("#showOption option").each(function () {
            if ($(this).val() == '' || $(this).attr("class") == value) { //通过判断class名称判断是否显示
                $("#comeFrom").append($(this).clone(true)); //为Select追加一个Option(下拉项)
                if ($(this).val() == '') {
                    $(this).prop("selected", true)
                }
            }
        });

    });

    function clear_params(){
        $("#from").val(0);
        $("#pay_status").val(0);
        $("#comeFrom").val('-2');
        $("#location_area").val();
        $("#order_no").val('');
    }

</script>